package com.jersey;

import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;


@XmlAccessorType(XmlAccessType.FIELD)
public class MerchantBean {
	private Integer merchantID;
	private String name;
	private String logo;
	private String tagline;
	private String accountNumber;
	private String customID;
	private Integer regionKey;
	@XmlElement(name = "redemptionLocation")
	private List<LocationBean> redemptionLocationInfoBean;
	@XmlElement(name = "merchantContactInfo")
	private LocationBean merchantContactInfoBean;

	/**
	 * @return the merchantID
	 */
	public Integer getMerchantID() {
		return merchantID == null ? 0 : merchantID;
	}
	/**
	 * @param merchantID the merchantID to set
	 */
	public void setMerchantID(Integer merchantID) {
		this.merchantID = merchantID;
	}
	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}
	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}
	/**
	 * @return the logo
	 */
	public String getLogo() {
		return logo;
	}
	/**
	 * @param logo the logo to set
	 */
	public void setLogo(String logo) {
		this.logo = logo;
	}
	/**
	 * @return the tagline
	 */
	public String getTagline() {
		return tagline;
	}
	/**
	 * @param tagline the tagline to set
	 */
	public void setTagline(String tagline) {
		this.tagline = tagline;
	}
	/**
	 * @return the accountNumber
	 */
	public String getAccountNumber() {
		return accountNumber;
	}
	/**
	 * @param accountNumber the accountNumber to set
	 */
	public void setAccountNumber(String accountNumber) {
		this.accountNumber = accountNumber;
	}
	/**
	 * @return the regionKey
	 */
	public Integer getRegionKey() {
		return regionKey;
	}
	/**
	 * @param regionKey the regionKey to set
	 */
	public void setRegionKey(Integer regionKey) {
		this.regionKey = regionKey;
	}
	/**
	 * @return the redemptionLocationInfoBean
	 */
	public List<LocationBean> getRedemptionLocationInfoBean() {
		return redemptionLocationInfoBean;
	}
	/**
	 * @param redemptionLocationInfoBean the redemptionLocationInfoBean to set
	 */
	public void setRedemptionLocationInfoBean(
			List<LocationBean> redemptionLocationInfoBean) {
		this.redemptionLocationInfoBean = redemptionLocationInfoBean;
	}
	/**
	 * @return the merchantContactInfoBean
	 */
	public LocationBean getMerchantContactInfoBean() {
		return merchantContactInfoBean;
	}
	/**
	 * @param merchantContactInfoBean the merchantContactInfoBean to set
	 */
	public void setMerchantContactInfoBean(LocationBean merchantContactInfoBean) {
		this.merchantContactInfoBean = merchantContactInfoBean;
	}
	
	public boolean hasRedemptionLocation() {
		return getRedemptionLocationInfoBean() != null && getRedemptionLocationInfoBean().size() > 0;
	}
	public void addRedemptionLocation(LocationBean redemptionLocationInfo) {
		if(this.getRedemptionLocationInfoBean() == null) {
			this.redemptionLocationInfoBean = new ArrayList<LocationBean>(0);
		}
		this.redemptionLocationInfoBean.add(redemptionLocationInfo);
	}


	/**
	 * @param customID the customID to set
	 */
	public void setCustomID(String customID) {
		this.customID = customID;
	}


	/**
	 * @return the customID
	 */
	public String getCustomID() {
		return customID;
	}

	public boolean isPersistent() {
		return getMerchantID() > 0;
	}
}
